#ifndef FRMMAIN_H
#define FRMMAIN_H

#include <QDialog>
#include <QByteArray>
#include "qextserialport/qextserialport.h"

class QMenu;

#pragma pack(1)
typedef struct {
    quint8   head[6];  //update
    char     name[20]; //example dpf release
    quint16   updateNum;
    quint8   encryptMode;
    quint32  fileSize;
    quint16  fileCrc;
    quint16  headCrc;
}sw_head_t;
#pragma pack()


namespace Ui {
class frmMain;
}

class frmMain : public QDialog
{
    Q_OBJECT

public:
    explicit frmMain(QWidget *parent = 0);
    ~frmMain();

protected:
    bool eventFilter(QObject *obj, QEvent *event);
    void mouseMoveEvent(QMouseEvent *e);
    void mousePressEvent(QMouseEvent *e);
    void mouseReleaseEvent(QMouseEvent *);


private slots:
    void changeStyle();
    void on_btnMenu_Close_clicked();
    void on_btnMenu_Max_clicked();
    void on_btnMenu_Min_clicked();
    void on_btnMenu_clicked();

    void on_btnSelectFile_clicked();

    void on_btnGenerateFile_clicked();

private:
    Ui::frmMain *ui;

    QPoint mousePoint;
    bool mousePressed;
    bool max;
    QMenu *menu;
    QRect location;


    QByteArray binFileData;
    QByteArray aesFileData;
    sw_head_t sw_head;
    quint32 scrFileSize;

    void InitStyle();
    void initApp();
    bool read_bin_file(QString path);

};

#endif // FRMMAIN_H
